<template>
	<div>
		<ul>
			<li v-for = 'item in goodsList' @click = 'gotoDetiles(item.productID)'>
				<img />
				<p><span>{{item.productName}}</span><span>{{item.unitPrice}}元</span></p>
				<p><span>{{item.Category}}</span><span>{{item.other}}</span></p>
			</li>
			
		</ul>
	</div>
</template>

<script>
import axios from 'axios'
	export default{
		name:'goodsList',
		data(){
			return{
				goodsList:[]
			}
		},
		created(){
			this.$axios.get('/shopCar/goodsList').then(res=>{  //请求接口
				console.log(res.data.result);
				if(res.data.code==200){//返回成功
					this.goodsList = res.data.result;
				}
			})
		},
		methods:{
			gotoDetiles(a){
				console.log(a);
			}
		}
	}
</script>

<style lang="less" scoped="scoped">
	ul li{
		list-style: none;
	}
</style>